const API = require('./base')

export function getCreditShopList(data) {
  return API.get('/wp-json/mp/v2/products', data, {
    token: true
  })
}


export function getShopList(data) {
  return API.get('/wp-json/mp/v2/goods', data, {
    token: true
  })
}

export function getHotShopList(data){
  return API.get('/wp-json/mp/v2/goods?custom=meta&key=hot', data, {
    token: true
  })
}

export function getStickyShopList(data){
  return API.get('/wp-json/mp/v2/goods?sticky=true', data, {
    token: true
  })
}

export function getProductByID(id) {
  return API.get('/wp-json/mp/v2/products/' + id, {}, {
    token: true
  });
}

export function credit(args) {
  return API.post('/wp-json/mp/v2/pay/credit', args, {
    token: true
  });
}

export function getOrderLists(args){
  return API.get('/wp-json/mp/v2/user/orders', args, {
    token: true
  });
}

export function getExpresss(args) {
  return API.post('/wp-json/mp/v2/express', args, {
    token: true
  });
}

export function setOrder(args) {
  return API.post('/wp-json/mp/v2/user/orders', args, {
    token: true
  });
}

export function getProductList(data) {
  return API.get('/wp-json/wp/v2/cats?orderby=id&order=asc&per_page=20', data, {
    token: true
  });
}

export function getMiniShopList(data){
  return API.get('/wp-json/mp/v2/westore/products', data, {
    token: true
  });
}

export function getMiniShopCates(data){
  return API.get('/wp-json/wp/v2/sort', data, {
    token: true
  });
}

export function getCouponsList(data){
  return API.get('/wp-json/mp/v2/westore/coupons', data, {
    token: true
  });
}

export function getCoupon(data){
  return API.post('/wp-json/mp/v2/westore/coupons', data, {
    token: true
  });
}

